
StepsPlugin : AbstractControlPlugin{ 
	
	var usefulArray;
	
	getSpecs{
		^Dictionary[
			\step1Repeats -> ControlSpec.new( minval:0, maxval:32, step:1),	
			\step2Repeats -> ControlSpec.new( minval:0, maxval:32, step:1),	
			\step3Repeats -> ControlSpec.new( minval:0, maxval:32, step:1),	
			\step4Repeats -> ControlSpec.new( minval:0, maxval:32, step:1)
		]
	}
	
	populateVals{
		vals.put(\step1Val, 1);
		vals.put(\step1Repeats, 1);
		vals.put(\step2Val, 0);
		vals.put(\step2Repeats, 0);
		vals.put(\step3Val, 0);
		vals.put(\step3Repeats, 0);
		vals.put(\step4Val, 0);
		vals.put(\step4Repeats, 0);
	}
	
	process{	
		arg val;
		currentStep = currentStep + 1;
		if(usefulArray.size == 0){
			^val;
		};
		^val * usefulArray.wrapAt(currentStep);
	}
	
	createArray{
		var multiplyBy, steps;
		usefulArray = List.new;
		vals.keysValuesDo{|key,val|
			if(val != nil && key.asString.contains("Val") ){
				("val" + val).postln;
				multiplyBy = val;	
			};
			if(val != nil && key.asString.contains("Repeats") ){
				steps = val;
				steps.do{
					usefulArray.add(multiplyBy);
				}	
			}	
		};
	}
	
	onSetValue{
		this.createArray;	
	}
	
	onInit{
		this.createArray;
	}
	
	

}